package myJs.api

import myJs.Implicits._
import myJs.myPkg.MyFetch
import myJs.tool.Pojo.Basic344TpmData
import upickle.default.read

import scala.concurrent.ExecutionContext.Implicits.global

/**
 * Created by yz on 25/5/2022
 */
object ExpH2Api {

  val baseUrl=s"${Api.apiUrl}/nut/expH2"

  def barData(geneId: String) = {
    val url = s"${baseUrl}/getByGeneId"
    MyFetch.getRnStr(url = s"${url}?geneId=${geneId}").map { str =>
      read[Option[Basic344TpmData]](str)
    }
  }

  def allByServer(dataStr: String) = {
    val url = s"${baseUrl}/allByServer"
    MyFetch.postRnText(url = s"${url}", data = dataStr, headers = Map("Content-Type" -> "application/json")).map { str =>
      str.toObj
    }
  }


}
